#ifndef GENETIC_SOLVER_HPP_
#	define GENETIC_SOLVER_HPP_

#	include "Solver.hpp"
#	include <vector>

// attention Popsize doit etre puissance de 2

class GeneticSolver : public Solver
{
	public:
		GeneticSolver(VRPTW&	inVRPTW, unsigned	inPopSize)
			: 	Solver(inVRPTW), 
				gsPopulation(((inPopSize & 1) == 0) ? inPopSize : inPopSize + 1, Solution(inVRPTW)),
				gsFathers(gsPopulation.size() >> 1),
				gsSons(gsPopulation.size() >> 1),
				gsTmp(gsPopulation.size() >> 1)
		{}
		
		~GeneticSolver();
		
		void	execute() EXC_THROWER();
		
		unsigned	getPopSize() const
		{	return gsPopulation.size();	}
		
	protected:
		std::vector<Tournee>	gsPopulation;
		std::vector<Tournee*>	gsFathers;
		std::vector<Tournee*>	gsSons;
		std::vector<Tournee*>	gsTmp;
		
		
		void		init();
		void		cross_over(	Tournee& in1, Tournee& in2, Solution& inSon) EXC_THROWER();
};


#endif
